package cn.ranko.shiro.applicationlistener;

import cn.ranko.shiro.service.SysMenuService;
import cn.ranko.shiro.utils.ConstantUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * Created by zhujun on 2017/8/13.
 *
 * 系统初始化，菜单、变量、初始化
 *
 */
public class InitializationApplicationListener implements ApplicationListener<ContextRefreshedEvent> {

    @Autowired
    SysMenuService menuService;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {

        ConstantUtil.menus = menuService.getMenus();

    }
}
